// interface Animal{
//     eat():void
// }
// interface Person extends Animal{
//     work():void
// }

// class Web implements Person{
//     public name:string;
//     constructor (name:string){
//         this.name=name
//     }
//     eat(){
//         console.log(this.name+'在吃饭')
//     }
//     work(){
//        console.log(this.name+'在工作')
//     }
// }

// let w1=new Web('zhansan')
// w1.work()


//例2

interface Animal{
    eat():void
}
interface Person extends Animal{
    work():void
}

class People {
    public name:string;
    constructor(name){
        this.name=name
    }
    code(code){
        console.log(this.name+code)
    }
}
class Web extends People implements Person{
    public name:string;
    constructor(name){
        super(name)
        // this.name=name
    }
    eat(){
        console.log(this.name+'吃饭')
    }
    work(){
        console.log(this.name+'工作')
    }
}

let w2=new Web('小李')
w2.code('在写ts')
w2.eat()